using BackData;
using Domain.DTOs.BOMs;
using MediatR;
using System.ComponentModel.DataAnnotations;

namespace Team.API.Applocation.Command.BOM
{
    /// <summary>
    /// 更新成品BOM命令
    /// </summary>
    public class UpdateProductBOMCommand : IRequest<APIResult<BOMDTO>>
    {
        /// <summary>
        /// BOM主键ID
        /// </summary>
        [Required(ErrorMessage = "BOM ID不能为空")]
        public long Id { get; set; }

        /// <summary>
        /// 物品编号（成品编码）
        /// </summary>
        [Required(ErrorMessage = "成品编码不能为空")]
        public string Itemcode { get; set; } = string.Empty;

        /// <summary>
        /// 产品名称（成品名称）
        /// </summary>
        [Required(ErrorMessage = "成品名称不能为空")]
        public string Goodsname { get; set; } = string.Empty;

        /// <summary>
        /// 规格型号
        /// </summary>
        public string Spec { get; set; } = string.Empty;

        /// <summary>
        /// 单位（个、米、千克等）
        /// </summary>
        public string Unit { get; set; } = string.Empty;

        /// <summary>
        /// 物料清单版本
        /// </summary>
        public string Version { get; set; } = "1.0V";

        /// <summary>
        /// 数量
        /// </summary>
        [Range(1, int.MaxValue, ErrorMessage = "数量必须大于0")]
        public int Number { get; set; } = 1;

        /// <summary>
        /// 备注
        /// </summary>
        public string? Remark { get; set; }

        /// <summary>
        /// 是否使用
        /// </summary>
        public bool IsUse { get; set; } = true;

        /// <summary>
        /// 当前登录人姓名（用于记录操作日志）
        /// </summary>
        public string? CurrentUserName { get; set; }
    }
}

